﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Company/Company.master" Inherits="WebManager.BasePage" %>

<%@ Import Namespace="TalentPools.BLL" %>
<%@ Import Namespace="TalentPools.Model" %>
<script runat="server">

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            string pwd = MyFormatstr(FormsAuthentication.HashPasswordForStoringInConfigFile(txtpwd.Text.Trim(), "MD5"));
            if (new Company_LoginManager().CheckPwd(session, pwd))
            {
                if (new Company_LoginManager().EditPwd(session, pwd))
                {
                    Label2.Text = "修改密码成功!";
                }
                else
                {
                    Label2.Text = "修改密码失败!";
                }
            }
            else
            {
                Label2.Text = "原密码错误，请确认后重新输入!";
            }
        }
    }
    string session;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsQyLogin())
        {
            JsWindows("企业用户请先登录", "../Index.aspx");
            return;
        }
        session = Request.Cookies["qyUser"].Values["name"];
    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        .style5
        {
            background: #F0F8F0;
            line-height: 120%;
            height: 17px;
        }
        .style6
        {
            background: #E0EEF5;
            line-height: 120%;
            height: 17px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>
        <tr class='tdbg'>
            <td colspan="2" class="topbg2">
                <div align="center" class="Glow">
                    <strong>修改密码</strong></div>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <div align="right">
                        <span style="color: #ff0000">*</span>原密码：</div>
                </div>
            </td>
            <td class="tdbg2">
                <asp:TextBox ID="txtpwd" runat="server" MaxLength="20"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="请输入原密码"
                    ControlToValidate="txtpwd"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="style5">
                <div align="right">
                    <span style="color: #ff0000">*</span>新密码：</div>
            </td>
            <td class="style6">
                <asp:TextBox ID="txtnewpwd" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="请输入新密码"
                    ControlToValidate="txtnewpwd"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <span style="color: #ff0000">*</span>再次输入新密码：</div>
            </td>
            <td class="tdbg2">
                <asp:TextBox ID="txtrenewpwd" runat="server" MaxLength="20"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="请再次输入新密码"
                    ControlToValidate="txtrenewpwd"></asp:RequiredFieldValidator>
                <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="两次输入的密码不同"
                    ControlToCompare="txtnewpwd" ControlToValidate="txtrenewpwd"></asp:CompareValidator>
            </td>
        </tr>
    </table>
    <table width="100%" border="0">
        <tr>
            <td>
                <div align="center">
                    <asp:Button ID="btnSubmit" runat="server" Text="提交" OnClick="btnSubmit_Click" />
                    <label>
                        &nbsp;<input type="reset" name="Submit2" value="重置" />
                        <br />
                        <asp:Label ID="Label2" runat="server" ForeColor="Red"></asp:Label></label></div>
            </td>
        </tr>
    </table>
</asp:Content>
